package com.ruoyi.log.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.log.domain.ApproveLog;
import com.ruoyi.log.service.IApproveLogService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 审批日志Controller
 * 
 * @author ruoyi
 * @date 2024-08-02
 */
@RestController
@RequestMapping("/ approveLog/ approveLog")
public class ApproveLogController extends BaseController
{
    @Autowired
    private IApproveLogService t19Service;

    /**
     * 查询审批日志列表
     */
    @PreAuthorize("@ss.hasPermi(' approveLog: approveLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(ApproveLog t19)
    {
        startPage();
        List<ApproveLog> list = t19Service.selectApproveLogList(t19);
        return getDataTable(list);
    }

    /**
     * 导出审批日志列表
     */
    @PreAuthorize("@ss.hasPermi(' approveLog: approveLog:export')")
    @Log(title = "审批日志", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ApproveLog t19)
    {
        List<ApproveLog> list = t19Service.selectApproveLogList(t19);
        ExcelUtil<ApproveLog> util = new ExcelUtil<ApproveLog>(ApproveLog.class);
        util.exportExcel(response, list, "审批日志数据");
    }

    /**
     * 获取审批日志详细信息
     */
    @PreAuthorize("@ss.hasPermi(' approveLog: approveLog:query')")
    @GetMapping(value = "/{F1901}")
    public AjaxResult getInfo(@PathVariable("F1901") Long F1901)
    {
        return success(t19Service.selectApproveLogByF1901(F1901));
    }

    /**
     * 新增审批日志
     */
    @PreAuthorize("@ss.hasPermi(' approveLog: approveLog:add')")
    @Log(title = "审批日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ApproveLog t19)
    {
        return toAjax(t19Service.insertApproveLog(t19));
    }

    /**
     * 修改审批日志
     */
    @PreAuthorize("@ss.hasPermi(' approveLog: approveLog:edit')")
    @Log(title = "审批日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ApproveLog t19)
    {
        return toAjax(t19Service.updateApproveLog(t19));
    }

    /**
     * 删除审批日志
     */
    @PreAuthorize("@ss.hasPermi(' approveLog: approveLog:remove')")
    @Log(title = "审批日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{F1901s}")
    public AjaxResult remove(@PathVariable Long[] F1901s)
    {
        return toAjax(t19Service.deleteApproveLogByF1901s(F1901s));
    }
}
